﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using Character;
using SEXY;
using UnityEngine;
using Utility;

// Token: 0x0200014D RID: 333
public abstract class Human : MonoBehaviour
{
	// Token: 0x170000FA RID: 250
	// (get) Token: 0x0600082C RID: 2092 RVA: 0x00031158 File Offset: 0x0002F358
	// (set) Token: 0x0600082D RID: 2093 RVA: 0x00031160 File Offset: 0x0002F360
	public SEX sex { get; protected set; }

	// Token: 0x170000FB RID: 251
	// (get) Token: 0x0600082E RID: 2094 RVA: 0x0003116C File Offset: 0x0002F36C
	// (set) Token: 0x0600082F RID: 2095 RVA: 0x00031174 File Offset: 0x0002F374
	public CustomParameter customParam { get; protected set; }

	// Token: 0x170000FC RID: 252
	// (get) Token: 0x06000830 RID: 2096 RVA: 0x00031180 File Offset: 0x0002F380
	// (set) Token: 0x06000831 RID: 2097 RVA: 0x00031188 File Offset: 0x0002F388
	public Head head { get; protected set; }

	// Token: 0x170000FD RID: 253
	// (get) Token: 0x06000832 RID: 2098 RVA: 0x00031194 File Offset: 0x0002F394
	// (set) Token: 0x06000833 RID: 2099 RVA: 0x0003119C File Offset: 0x0002F39C
	public Body body { get; protected set; }

	// Token: 0x170000FE RID: 254
	// (get) Token: 0x06000834 RID: 2100 RVA: 0x000311A8 File Offset: 0x0002F3A8
	// (set) Token: 0x06000835 RID: 2101 RVA: 0x000311B0 File Offset: 0x0002F3B0
	public Hairs hairs { get; protected set; }

	// Token: 0x170000FF RID: 255
	// (get) Token: 0x06000836 RID: 2102 RVA: 0x000311BC File Offset: 0x0002F3BC
	// (set) Token: 0x06000837 RID: 2103 RVA: 0x000311C4 File Offset: 0x0002F3C4
	public Wears wears { get; protected set; }

	// Token: 0x17000100 RID: 256
	// (get) Token: 0x06000838 RID: 2104 RVA: 0x000311D0 File Offset: 0x0002F3D0
	// (set) Token: 0x06000839 RID: 2105 RVA: 0x000311D8 File Offset: 0x0002F3D8
	public Accessories accessories { get; protected set; }

	// Token: 0x17000101 RID: 257
	// (get) Token: 0x0600083A RID: 2106 RVA: 0x000311E4 File Offset: 0x0002F3E4
	// (set) Token: 0x0600083B RID: 2107 RVA: 0x000311EC File Offset: 0x0002F3EC
	public AnimeLipSync lipSync { get; protected set; }

	// Token: 0x17000102 RID: 258
	// (get) Token: 0x0600083C RID: 2108 RVA: 0x000311F8 File Offset: 0x0002F3F8
	// (set) Token: 0x0600083D RID: 2109 RVA: 0x00031200 File Offset: 0x0002F400
	public AnimeParamBlink blink { get; protected set; }

	// Token: 0x17000103 RID: 259
	// (get) Token: 0x0600083E RID: 2110 RVA: 0x0003120C File Offset: 0x0002F40C
	// (set) Token: 0x0600083F RID: 2111 RVA: 0x00031214 File Offset: 0x0002F414
	public IK_Control ik { get; protected set; }

	// Token: 0x17000104 RID: 260
	// (get) Token: 0x06000840 RID: 2112 RVA: 0x00031220 File Offset: 0x0002F420
	// (set) Token: 0x06000841 RID: 2113 RVA: 0x00031228 File Offset: 0x0002F428
	public float TearsRate { get; protected set; }

	// Token: 0x17000105 RID: 261
	// (get) Token: 0x06000842 RID: 2114 RVA: 0x00031234 File Offset: 0x0002F434
	// (set) Token: 0x06000843 RID: 2115 RVA: 0x0003123C File Offset: 0x0002F43C
	public float FlushRate { get; protected set; }

	// Token: 0x17000106 RID: 262
	// (get) Token: 0x06000844 RID: 2116 RVA: 0x00031248 File Offset: 0x0002F448
	// (set) Token: 0x06000845 RID: 2117 RVA: 0x00031250 File Offset: 0x0002F450
	public TONGUE_TYPE TongueType { get; protected set; }

	// Token: 0x17000107 RID: 263
	// (get) Token: 0x06000846 RID: 2118 RVA: 0x0003125C File Offset: 0x0002F45C
	public LookAtRotator EyeLook
	{
		get
		{
			return this.eyeLook;
		}
	}

	// Token: 0x17000108 RID: 264
	// (get) Token: 0x06000847 RID: 2119 RVA: 0x00031264 File Offset: 0x0002F464
	public LookAtRotator NeckLook
	{
		get
		{
			return this.neckLook;
		}
	}

	// Token: 0x17000109 RID: 265
	// (get) Token: 0x06000848 RID: 2120 RVA: 0x0003126C File Offset: 0x0002F46C
	// (set) Token: 0x06000849 RID: 2121 RVA: 0x00031274 File Offset: 0x0002F474
	public Transform HeadPosTrans { get; protected set; }

	// Token: 0x1700010A RID: 266
	// (get) Token: 0x0600084A RID: 2122 RVA: 0x00031280 File Offset: 0x0002F480
	public Vector3 FacePos
	{
		get
		{
			return this.HeadPosTrans.TransformPoint(new Vector3(0f, 0f, 0.08f));
		}
	}

	// Token: 0x1700010B RID: 267
	// (get) Token: 0x0600084B RID: 2123 RVA: 0x000312A4 File Offset: 0x0002F4A4
	// (set) Token: 0x0600084C RID: 2124 RVA: 0x000312AC File Offset: 0x0002F4AC
	public Transform BrestPosTrans { get; protected set; }

	// Token: 0x1700010C RID: 268
	// (get) Token: 0x0600084D RID: 2125 RVA: 0x000312B8 File Offset: 0x0002F4B8
	// (set) Token: 0x0600084E RID: 2126 RVA: 0x000312C0 File Offset: 0x0002F4C0
	public Transform CrotchTrans { get; protected set; }

	// Token: 0x1700010D RID: 269
	// (get) Token: 0x0600084F RID: 2127 RVA: 0x000312CC File Offset: 0x0002F4CC
	// (set) Token: 0x06000850 RID: 2128 RVA: 0x000312D4 File Offset: 0x0002F4D4
	public bool IsRestrict { get; protected set; }

	// Token: 0x06000851 RID: 2129 RVA: 0x000312E0 File Offset: 0x0002F4E0
	public void SetDefParam()
	{
		this.customParam.head.eyeScleraColorL = this.defParam.eyeScleraColor;
		this.customParam.head.eyeScleraColorL = this.defParam.eyeScleraColor;
		this.customParam.head.eyeIrisColorL = this.defParam.eyeIrisColor;
		this.customParam.head.eyeIrisColorR = this.defParam.eyeIrisColor;
		this.customParam.head.eyePupilDilationL = 0f;
		this.customParam.head.eyePupilDilationR = 0f;
		this.customParam.head.eyeEmissiveL = 0.5f;
		this.customParam.head.eyeEmissiveR = 0.5f;
	}

	// Token: 0x06000852 RID: 2130
	public abstract void Save(string file);

	// Token: 0x06000853 RID: 2131
	public abstract void Save(string file, Texture2D tex);

	// Token: 0x06000854 RID: 2132
	public abstract LOAD_MSG Load(string file, int filter = -1);

	// Token: 0x06000855 RID: 2133
	public abstract LOAD_MSG Load(TextAsset text, int filter = -1);

	// Token: 0x06000856 RID: 2134
	public abstract void SaveCoordinate(string file);

	// Token: 0x06000857 RID: 2135
	public abstract void SaveCoordinate(string file, Texture2D tex);

	// Token: 0x06000858 RID: 2136
	public abstract LOAD_MSG LoadCoordinate(string file, int filter = -1);

	// Token: 0x06000859 RID: 2137
	public abstract LOAD_MSG LoadCoordinate(TextAsset text, int filter = -1);

	// Token: 0x1700010E RID: 270
	// (get) Token: 0x0600085A RID: 2138 RVA: 0x000313B0 File Offset: 0x0002F5B0
	// (set) Token: 0x0600085B RID: 2139 RVA: 0x000313B8 File Offset: 0x0002F5B8
	public GAG_ITEM GagType { get; protected set; }

	// Token: 0x1700010F RID: 271
	// (get) Token: 0x0600085C RID: 2140 RVA: 0x000313C4 File Offset: 0x0002F5C4
	// (set) Token: 0x0600085D RID: 2141 RVA: 0x000313CC File Offset: 0x0002F5CC
	public bool GagShow
	{
		get
		{
			return this.gagShow;
		}
		set
		{
			this.ChangeShowGag(value);
		}
	}

	// Token: 0x17000110 RID: 272
	// (get) Token: 0x0600085E RID: 2142 RVA: 0x000313D8 File Offset: 0x0002F5D8
	public bool Gag
	{
		get
		{
			return this.gagItem != null && this.gagShow;
		}
	}

	// Token: 0x17000111 RID: 273
	// (get) Token: 0x0600085F RID: 2143 RVA: 0x000313F0 File Offset: 0x0002F5F0
	// (set) Token: 0x06000860 RID: 2144 RVA: 0x000313F8 File Offset: 0x0002F5F8
	public CharReference charReference { get; set; }

	// Token: 0x17000112 RID: 274
	// (get) Token: 0x06000861 RID: 2145 RVA: 0x00031404 File Offset: 0x0002F604
	public GameObject objBodyBone
	{
		get
		{
			return this.body.AnimatedBoneRoot.gameObject;
		}
	}

	// Token: 0x17000113 RID: 275
	// (get) Token: 0x06000862 RID: 2146 RVA: 0x00031418 File Offset: 0x0002F618
	// (set) Token: 0x06000863 RID: 2147 RVA: 0x00031420 File Offset: 0x0002F620
	public bool visibleAll { get; protected set; }

	// Token: 0x06000864 RID: 2148 RVA: 0x0003142C File Offset: 0x0002F62C
	public void Load(CustomParameter copy, bool _apply = true)
	{
		this.customParam.Copy(copy, -1);
		if (_apply)
		{
			this.Apply();
		}
	}

	// Token: 0x06000865 RID: 2149 RVA: 0x00031448 File Offset: 0x0002F648
	protected LOAD_MSG Load(TextAsset text, bool female, bool male, int filter = -1)
	{
		if (text == null)
		{
			GlobalData.Debug_LogError("不明的二进制卡");
			return LOAD_MSG.DO_NOT_LOAD;
		}
		LOAD_MSG result = LOAD_MSG.PERFECT;
		using (MemoryStream memoryStream = new MemoryStream(text.bytes))
		{
			using (BinaryReader binaryReader = new BinaryReader(memoryStream))
			{
				result = this.Load(binaryReader, female, male, filter);
			}
		}
		return result;
	}

	// Token: 0x06000866 RID: 2150 RVA: 0x000314D0 File Offset: 0x0002F6D0
	protected LOAD_MSG Load(string file, bool female, bool male, int filter = -1)
	{
		LOAD_MSG load_MSG = LOAD_MSG.PERFECT;
		using (FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read))
		{
			using (BinaryReader binaryReader = new BinaryReader(fileStream))
			{
				load_MSG = this.Load(binaryReader, female, male, filter);
				if ((load_MSG & LOAD_MSG.DO_NOT_LOAD) != LOAD_MSG.PERFECT)
				{
					GlobalData.Debug_LogError("读取失败了:" + file);
				}
			}
		}
		return load_MSG;
	}

	// Token: 0x06000867 RID: 2151 RVA: 0x00031554 File Offset: 0x0002F754
	protected LOAD_MSG Load(BinaryReader reader, bool female, bool male, int filter = -1)
	{
		LOAD_MSG load_MSG = LOAD_MSG.PERFECT;
		bool flag = false;
		CustomParameter customParameter = new CustomParameter(this.customParam);
		try
		{
			long offset = PNG_Loader.CheckSize(reader);
			reader.BaseStream.Seek(offset, SeekOrigin.Begin);
			string text = reader.ReadString();
			if (text == "【HoneySelectCharaFemale】")
			{
				GlobalData.Debug_Log("蜂蜜精选：女");
				load_MSG |= LOAD_MSG.VER_HONEYSELECT;
				if (female)
				{
					reader.BaseStream.Seek(offset, SeekOrigin.Begin);
					CharFemaleFile charFemaleFile = new CharFemaleFile();
					flag = charFemaleFile.Load(reader, false, true);
					customParameter.FromSexyData(charFemaleFile);
					flag = true;
				}
				else
				{
					GlobalData.Debug_LogWarning("异性数据");
					load_MSG |= LOAD_MSG.ISOMERISM;
				}
			}
			else if (text == "【PremiumResortCharaFemale】")
			{
				GlobalData.Debug_Log("性感海滩高级度假村：女");
				load_MSG |= LOAD_MSG.VER_SEXYBEACH;
				if (female)
				{
					reader.BaseStream.Seek(0L, SeekOrigin.Begin);
					CharFemaleFile charFemaleFile2 = new CharFemaleFile();
					flag = charFemaleFile2.LoadFromSBPR(reader);
					customParameter.FromSexyData(charFemaleFile2);
					flag = true;
				}
				else
				{
					GlobalData.Debug_LogWarning("异性数据");
					load_MSG |= LOAD_MSG.ISOMERISM;
				}
			}
			else if (text == "【PlayHome_Female】")
			{
				if (female)
				{
					customParameter.Load(reader);
					flag = true;
				}
				else
				{
					load_MSG |= LOAD_MSG.ISOMERISM;
					GlobalData.Debug_LogWarning("异性数据");
				}
			}
			else if (text == "【HoneySelectCharaMale】")
			{
				GlobalData.Debug_Log("蜂蜜精选：男");
				load_MSG |= LOAD_MSG.VER_HONEYSELECT;
				if (male)
				{
					reader.BaseStream.Seek(offset, SeekOrigin.Begin);
					CharMaleFile charMaleFile = new CharMaleFile();
					flag = charMaleFile.Load(reader, true, true);
					customParameter.FromSexyData(charMaleFile);
					flag = true;
				}
				else
				{
					GlobalData.Debug_LogWarning("异性数据");
					load_MSG |= LOAD_MSG.ISOMERISM;
				}
			}
			else if (text == "【PremiumResortCharaMale】")
			{
				GlobalData.Debug_Log("性感海滩高级度假村：男");
				load_MSG |= LOAD_MSG.VER_SEXYBEACH;
				if (male)
				{
					reader.BaseStream.Seek(0L, SeekOrigin.Begin);
					CharMaleFile charMaleFile2 = new CharMaleFile();
					flag = charMaleFile2.LoadFromSBPR(reader);
					customParameter.FromSexyData(charMaleFile2);
					flag = true;
				}
				else
				{
					GlobalData.Debug_LogWarning("异性数据");
					load_MSG |= LOAD_MSG.ISOMERISM;
				}
			}
			else if (text == "【PlayHome_Male】")
			{
				if (male)
				{
					customParameter.Load(reader);
					flag = true;
				}
				else
				{
					GlobalData.Debug_LogWarning("异性数据");
					load_MSG |= LOAD_MSG.ISOMERISM;
				}
			}
			else
			{
				GlobalData.Debug_LogWarning("无法读取的保存数据:" + text);
				load_MSG |= LOAD_MSG.DO_NOT_LOAD;
			}
		}
		catch (Exception message)
		{
			GlobalData.Debug_LogError(message);
			load_MSG |= LOAD_MSG.DO_NOT_LOAD;
			flag = false;
		}
		if (flag)
		{
			this.customParam.Copy(customParameter, filter);
			this.Apply();
		}
		return load_MSG;
	}

	// Token: 0x06000868 RID: 2152 RVA: 0x00031800 File Offset: 0x0002FA00
	protected LOAD_MSG LoadCoordinate(TextAsset text, bool female, bool male, int filter = -1)
	{
		if (text == null)
		{
			GlobalData.Debug_LogError("不明的二进制卡");
			return LOAD_MSG.DO_NOT_LOAD;
		}
		LOAD_MSG load_MSG = LOAD_MSG.PERFECT;
		using (MemoryStream memoryStream = new MemoryStream(text.bytes))
		{
			using (BinaryReader binaryReader = new BinaryReader(memoryStream))
			{
				load_MSG |= this.LoadCoordinate(binaryReader, female, male, filter);
			}
		}
		return load_MSG;
	}

	// Token: 0x06000869 RID: 2153 RVA: 0x0003188C File Offset: 0x0002FA8C
	protected LOAD_MSG LoadCoordinate(string file, bool female, bool male, int filter = -1)
	{
		LOAD_MSG load_MSG = LOAD_MSG.PERFECT;
		using (FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read))
		{
			using (BinaryReader binaryReader = new BinaryReader(fileStream))
			{
				load_MSG |= this.LoadCoordinate(binaryReader, female, male, filter);
			}
		}
		return load_MSG;
	}

	// Token: 0x0600086A RID: 2154 RVA: 0x000318FC File Offset: 0x0002FAFC
	protected LOAD_MSG LoadCoordinate(BinaryReader reader, bool female, bool male, int filter = -1)
	{
		LOAD_MSG load_MSG = LOAD_MSG.PERFECT;
		bool flag = false;
		CustomParameter customParameter = new CustomParameter(this.customParam);
		try
		{
			long offset = PNG_Loader.CheckSize(reader);
			reader.BaseStream.Seek(offset, SeekOrigin.Begin);
			string text = reader.ReadString();
			if (text == "【HoneySelectClothesFemale】")
			{
				GlobalData.Debug_Log("蜂蜜精选：女");
				if (female)
				{
					reader.BaseStream.Seek(0L, SeekOrigin.Begin);
					CharFileInfoClothesFemale charFileInfoClothesFemale = new CharFileInfoClothesFemale();
					flag = charFileInfoClothesFemale.Load(reader, false);
					customParameter.FromSexyCoordinateData(charFileInfoClothesFemale);
					flag = true;
				}
				else
				{
					GlobalData.Debug_LogWarning("异性数据");
					load_MSG |= LOAD_MSG.ISOMERISM;
				}
			}
			else if (text == "【PlayHome_FemaleCoordinate】")
			{
				if (female)
				{
					customParameter.LoadCoordinate(reader);
					flag = true;
				}
				else
				{
					GlobalData.Debug_LogWarning("异性数据");
					load_MSG |= LOAD_MSG.ISOMERISM;
				}
			}
			else if (text == "【HoneySelectClothesMale】")
			{
				GlobalData.Debug_Log("蜂蜜精选：男");
				if (male)
				{
					reader.BaseStream.Seek(0L, SeekOrigin.Begin);
					CharFileInfoClothesMale charFileInfoClothesMale = new CharFileInfoClothesMale();
					flag = charFileInfoClothesMale.Load(reader, false);
					customParameter.FromSexyCoordinateData(charFileInfoClothesMale);
					flag = true;
				}
				else
				{
					GlobalData.Debug_LogWarning("异性数据");
					load_MSG |= LOAD_MSG.ISOMERISM;
				}
			}
			else if (text == "【PlayHome_MaleCoordinate】")
			{
				if (male)
				{
					customParameter.LoadCoordinate(reader);
					flag = true;
				}
				else
				{
					GlobalData.Debug_LogWarning("异性数据");
					load_MSG |= LOAD_MSG.ISOMERISM;
				}
			}
			else
			{
				GlobalData.Debug_LogWarning("无法读取的保存数据:" + text);
				load_MSG |= LOAD_MSG.DO_NOT_LOAD;
			}
		}
		catch (Exception message)
		{
			GlobalData.Debug_LogError(message);
			flag = false;
		}
		if (flag)
		{
			this.customParam.Copy(customParameter, filter);
			this.ApplyCoordinate();
		}
		return load_MSG;
	}

	// Token: 0x0600086B RID: 2155
	public abstract void Apply();

	// Token: 0x0600086C RID: 2156
	public abstract void ApplyCoordinate();

	// Token: 0x0600086D RID: 2157
	public abstract void ApplyHair();

	// Token: 0x0600086E RID: 2158
	public abstract void ChangeHead();

	// Token: 0x0600086F RID: 2159 RVA: 0x00031AD0 File Offset: 0x0002FCD0
	protected void ChangeHead(string hairParentName)
	{
		this.accessories.DetachHeadAccessory(this.customParam.acce);
		this.hairs.DetachHairs();
		HumanAttachItem humanAttachItem = this.DetachGag();
		this.head.Load(this.customParam.head);
		Transform parent = Transform_Utility.FindTransform(this.head.Obj.transform, hairParentName);
		this.hairs.AttachHairs(parent);
		this.accessories.AttachHeadAccessory(this.customParam.acce);
		this.lipSync = base.GetComponentInChildren<AnimeLipSync>();
		this.blink = base.GetComponentInChildren<AnimeParamBlink>();
		this.head.SetShowTongue(this.TongueType == TONGUE_TYPE.FACE);
		this.ReAttachGag();
	}

	// Token: 0x06000870 RID: 2160 RVA: 0x00031B88 File Offset: 0x0002FD88
	protected virtual void Update()
	{
		this.head.Update();
		this.body.Update();
	}

	// Token: 0x06000871 RID: 2161 RVA: 0x00031BA0 File Offset: 0x0002FDA0
	protected virtual void LateUpdate()
	{
		this.ik.Update();
	}

	// Token: 0x06000872 RID: 2162 RVA: 0x00031BB0 File Offset: 0x0002FDB0
	protected IEnumerator ToCharaPNG(string file, string mark)
	{
		yield return new WaitForEndOfFrame();
		int width = Screen.width;
		int height = Screen.height;
		Texture2D tex = new Texture2D(width, height, TextureFormat.ARGB32, false);
		tex.ReadPixels(new Rect(0f, 0f, (float)width, (float)height), 0, 0);
		tex.Apply();
		byte[] png_bytes = tex.EncodeToPNG();
		UnityEngine.Object.Destroy(tex);
		using (FileStream fileStream = new FileStream(file, FileMode.Create, FileAccess.Write))
		{
			using (BinaryWriter binaryWriter = new BinaryWriter(fileStream))
			{
				binaryWriter.Write(png_bytes);
				binaryWriter.Write(mark);
				this.customParam.Save(binaryWriter);
				binaryWriter.Close();
			}
			fileStream.Close();
		}
		yield break;
	}

	// Token: 0x06000873 RID: 2163 RVA: 0x00031BDC File Offset: 0x0002FDDC
	protected void ToCharaPNG(string file, string mark, Texture2D tex)
	{
		byte[] buffer = tex.EncodeToPNG();
		using (FileStream fileStream = new FileStream(file, FileMode.Create, FileAccess.Write))
		{
			using (BinaryWriter binaryWriter = new BinaryWriter(fileStream))
			{
				binaryWriter.Write(buffer);
				binaryWriter.Write(mark);
				this.customParam.Save(binaryWriter);
				binaryWriter.Close();
			}
			fileStream.Close();
		}
	}

	// Token: 0x06000874 RID: 2164 RVA: 0x00031C68 File Offset: 0x0002FE68
	protected IEnumerator ToCoordinatePNG(string file, string mark)
	{
		yield return new WaitForEndOfFrame();
		int width = Screen.width;
		int height = Screen.height;
		Texture2D tex = new Texture2D(width, height, TextureFormat.ARGB32, false);
		tex.ReadPixels(new Rect(0f, 0f, (float)width, (float)height), 0, 0);
		tex.Apply();
		byte[] png_bytes = tex.EncodeToPNG();
		UnityEngine.Object.Destroy(tex);
		using (FileStream fileStream = new FileStream(file, FileMode.Create, FileAccess.Write))
		{
			using (BinaryWriter binaryWriter = new BinaryWriter(fileStream))
			{
				binaryWriter.Write(png_bytes);
				binaryWriter.Write(mark);
				this.customParam.SaveCoordinate(binaryWriter);
				binaryWriter.Close();
			}
			fileStream.Close();
		}
		yield break;
	}

	// Token: 0x06000875 RID: 2165 RVA: 0x00031C94 File Offset: 0x0002FE94
	protected void ToCoordinatePNG(string file, string mark, Texture2D tex)
	{
		byte[] buffer = tex.EncodeToPNG();
		using (FileStream fileStream = new FileStream(file, FileMode.Create, FileAccess.Write))
		{
			using (BinaryWriter binaryWriter = new BinaryWriter(fileStream))
			{
				binaryWriter.Write(buffer);
				binaryWriter.Write(mark);
				this.customParam.SaveCoordinate(binaryWriter);
				binaryWriter.Close();
			}
			fileStream.Close();
		}
	}

	// Token: 0x06000876 RID: 2166 RVA: 0x00031D20 File Offset: 0x0002FF20
	public void PhonationVoice(AudioClip clip, bool loop)
	{
		if (this.lipSync == null)
		{
			this.lipSync = base.GetComponentInChildren<AnimeLipSync>();
		}
		this.UpdateVoiceVolume();
		this.lipSync.audio.Stop();
		this.lipSync.audio.clip = clip;
		this.lipSync.audio.loop = loop;
		this.lipSync.audio.Play();
	}

	// Token: 0x06000877 RID: 2167 RVA: 0x00031D94 File Offset: 0x0002FF94
	public void SoundSpatialBlend(float blend)
	{
		this.lipSync.audio.spatialBlend = blend;
	}

	// Token: 0x06000878 RID: 2168 RVA: 0x00031DA8 File Offset: 0x0002FFA8
	public void VoiceShutUp()
	{
		if (this.lipSync == null)
		{
			this.lipSync = base.GetComponentInChildren<AnimeLipSync>();
		}
		this.lipSync.audio.Stop();
	}

	// Token: 0x06000879 RID: 2169 RVA: 0x00031DD8 File Offset: 0x0002FFD8
	private void UpdateVoiceVolume()
	{
		if (this.lipSync == null)
		{
			return;
		}
		this.lipSync.audio.volume = this.GetVolume();
		this.lipSync.audio.pitch = this.GetVoicePitch();
	}

	// Token: 0x0600087A RID: 2170
	protected abstract float GetVolume();

	// Token: 0x0600087B RID: 2171
	protected abstract float GetVoicePitch();

	// Token: 0x0600087C RID: 2172 RVA: 0x00031E18 File Offset: 0x00030018
	public bool IsVoicePlaying()
	{
		return this.lipSync != null && this.lipSync.audio != null && this.lipSync.audio.isPlaying;
	}

	// Token: 0x0600087D RID: 2173 RVA: 0x00031E58 File Offset: 0x00030058
	public bool IsLoopVoicePlaying()
	{
		return this.lipSync != null && this.lipSync.audio.clip != null && this.lipSync.audio.isPlaying && this.lipSync.audio.loop;
	}

	// Token: 0x0600087E RID: 2174 RVA: 0x00031EBC File Offset: 0x000300BC
	public virtual void BodyShapeInfoApply()
	{
		for (int i = 0; i < this.customParam.body.shapeVals.Length; i++)
		{
			this.body.Info.ChangeValue(i, this.customParam.body.shapeVals[i]);
		}
		this.body.Info.Update();
	}

	// Token: 0x0600087F RID: 2175 RVA: 0x00031F20 File Offset: 0x00030120
	public virtual void OnShapeApplied()
	{
	}

	// Token: 0x06000880 RID: 2176 RVA: 0x00031F24 File Offset: 0x00030124
	public virtual void SetupDynamicBones()
	{
	}

	// Token: 0x06000881 RID: 2177 RVA: 0x00031F28 File Offset: 0x00030128
	public virtual void UpdateSkinMaterial()
	{
		this.customParam.body.skinColor.SetToMaterial(this.body.SkinMaterial);
		this.customParam.body.skinColor.SetToMaterial(this.head.SkinMaterial);
	}

	// Token: 0x06000882 RID: 2178 RVA: 0x00031F78 File Offset: 0x00030178
	protected virtual string MouthExpressionCheck(string name)
	{
		return name;
	}

	// Token: 0x06000883 RID: 2179 RVA: 0x00031F7C File Offset: 0x0003017C
	public void ExpressionPlay(int layer, string name, float fixedTime)
	{
		if (layer == 0)
		{
			this.eyeState = name;
		}
		else if (layer == 1)
		{
			this.mouthState = name;
			name = this.MouthExpressionCheck(name);
		}
		else if (layer == 2)
		{
			this.lipSyncState = name;
		}
		if (this.head.Anime != null)
		{
			if (fixedTime <= 0f)
			{
				this.head.Anime.Play(name, layer);
			}
			else
			{
				this.head.Anime.CrossFadeInFixedTime(name, fixedTime, layer);
			}
		}
	}

	// Token: 0x06000884 RID: 2180 RVA: 0x00032010 File Offset: 0x00030210
	public void OpenEye(float v)
	{
		this.eyeOpen = v;
		if (this.blink)
		{
			this.blink.LimitMax = v;
		}
	}

	// Token: 0x06000885 RID: 2181 RVA: 0x00032038 File Offset: 0x00030238
	public void OpenMouth(float v)
	{
		this.mouthOpen = v;
		if (this.lipSync)
		{
			this.lipSync.RelaxOpen = v;
		}
	}

	// Token: 0x06000886 RID: 2182 RVA: 0x00032060 File Offset: 0x00030260
	public virtual void SetFlush(float rate, bool force = false)
	{
		this.FlushRate = rate;
	}

	// Token: 0x06000887 RID: 2183 RVA: 0x0003206C File Offset: 0x0003026C
	public virtual void SetTear(float rate, bool force = false)
	{
		this.TearsRate = rate;
	}

	// Token: 0x06000888 RID: 2184 RVA: 0x00032078 File Offset: 0x00030278
	public virtual void SetTongueType(TONGUE_TYPE type)
	{
		this.TongueType = type;
		this.head.SetShowTongue(type == TONGUE_TYPE.FACE);
		this.body.SetShowTongue(type == TONGUE_TYPE.BODY);
	}

	// Token: 0x06000889 RID: 2185
	public abstract void CheckShow();

	// Token: 0x0600088A RID: 2186 RVA: 0x000320A0 File Offset: 0x000302A0
	public void ChangeEyeLook(LookAtRotator.TYPE type, Transform tgt, bool force)
	{
		this.eyeLookType = type;
		this.eyeLookTarget = tgt;
		this.eyeLookForce = force;
		if (this.eyeLook != null)
		{
			this.eyeLook.Change(type, tgt, force);
		}
	}

	// Token: 0x0600088B RID: 2187 RVA: 0x000320D8 File Offset: 0x000302D8
	public void ChangeEyeLook(LookAtRotator.TYPE type, Vector3 tgt, bool force)
	{
		this.eyeLookType = type;
		this.eyeLookTarget = null;
		this.eyeLookForce = force;
		if (this.eyeLook != null)
		{
			this.eyeLook.Change(type, tgt, force);
		}
	}

	// Token: 0x0600088C RID: 2188 RVA: 0x00032110 File Offset: 0x00030310
	public void ChangeNeckLook(LookAtRotator.TYPE type, Transform tgt, bool force)
	{
		this.neckLookType = type;
		this.neckLookTarget = tgt;
		this.neckLookForce = force;
		if (this.neckLook != null)
		{
			this.neckLook.Change(type, tgt, force);
		}
	}

	// Token: 0x0600088D RID: 2189 RVA: 0x00032148 File Offset: 0x00030348
	public void ChangeNeckLook(LookAtRotator.TYPE type, Vector3 tgt, bool force)
	{
		this.neckLookType = type;
		this.neckLookTarget = null;
		this.neckLookForce = force;
		if (this.neckLook != null)
		{
			this.neckLook.Change(type, tgt, force);
		}
	}

	// Token: 0x0600088E RID: 2190 RVA: 0x00032180 File Offset: 0x00030380
	public virtual void Foot(MapData.FOOT foot)
	{
	}

	// Token: 0x0600088F RID: 2191 RVA: 0x00032184 File Offset: 0x00030384
	protected void AddAttachItem(HumanAttachItem item)
	{
		this.attachItem.Add(item.name, item);
	}

	// Token: 0x06000890 RID: 2192 RVA: 0x00032198 File Offset: 0x00030398
	protected void DelAttachItem(string name)
	{
		if (this.attachItem.ContainsKey(name))
		{
			UnityEngine.Object.Destroy(this.attachItem[name].obj);
			this.attachItem.Remove(name);
		}
	}

	// Token: 0x06000891 RID: 2193 RVA: 0x000321D0 File Offset: 0x000303D0
	protected void ClearAttachItems()
	{
		foreach (HumanAttachItem humanAttachItem in this.attachItem.Values)
		{
			UnityEngine.Object.Destroy(humanAttachItem.obj);
		}
		this.attachItem.Clear();
	}

	// Token: 0x06000892 RID: 2194 RVA: 0x00032240 File Offset: 0x00030440
	protected HumanAttachItem GetAttachItems(string name)
	{
		if (this.attachItem.ContainsKey(name))
		{
			return this.attachItem[name];
		}
		return null;
	}

	// Token: 0x06000893 RID: 2195 RVA: 0x00032264 File Offset: 0x00030464
	public virtual void ChangeGagItem()
	{
	}

	// Token: 0x06000894 RID: 2196 RVA: 0x00032268 File Offset: 0x00030468
	public virtual void ChangeShowGag(bool flag)
	{
		this.gagShow = flag;
	}

	// Token: 0x06000895 RID: 2197 RVA: 0x00032274 File Offset: 0x00030474
	protected virtual HumanAttachItem DetachGag()
	{
		if (this.gagItem != null)
		{
			this.gagItem.obj.transform.SetParent(null);
		}
		return this.gagItem;
	}

	// Token: 0x06000896 RID: 2198 RVA: 0x000322A0 File Offset: 0x000304A0
	protected virtual void ReAttachGag()
	{
	}

	// Token: 0x06000897 RID: 2199 RVA: 0x000322A4 File Offset: 0x000304A4
	public void RePlayMouthExpression()
	{
		this.ExpressionPlay(1, this.mouthState, 0f);
		this.OpenMouth(this.mouthOpen);
	}

	// Token: 0x06000898 RID: 2200 RVA: 0x000322C4 File Offset: 0x000304C4
	public void ChangeRestrict(bool set)
	{
		this.IsRestrict = set;
		if (!this.IsRestrict)
		{
			for (int i = 0; i < this.restrictItems.Count; i++)
			{
				this.DelAttachItem(this.restrictItems[i].name);
			}
			this.restrictItems.Clear();
		}
		if (this.IsRestrict && this.restrictItems.Count == 0)
		{
			GameObject gameObject = ResourceUtility.CreateInstance<GameObject>("RestrictRope");
			GameObject gameObject2 = ResourceUtility.CreateInstance<GameObject>("RestrictRope");
			Transform parent = Transform_Utility.FindTransform(this.body.Anime.transform, "N_Wrist_L");
			Transform parent2 = Transform_Utility.FindTransform(this.body.Anime.transform, "N_Wrist_R");
			gameObject.transform.SetParent(parent, false);
			gameObject2.transform.SetParent(parent2, false);
			this.restrictItems.Add(new HumanAttachItem("RestrictRope_L", gameObject));
			this.restrictItems.Add(new HumanAttachItem("RestrictRope_R", gameObject2));
			for (int j = 0; j < this.restrictItems.Count; j++)
			{
				this.AddAttachItem(this.restrictItems[j]);
			}
		}
	}

	// Token: 0x06000899 RID: 2201 RVA: 0x00032404 File Offset: 0x00030604
	private void Awake()
	{
		this.charReference = base.gameObject.GetOrAddComponent<CharReference>();
	}

	// Token: 0x0600089A RID: 2202 RVA: 0x00032418 File Offset: 0x00030618
	public GameObject GetReferenceInfo(CharReference.RefObjKey _key)
	{
		return this.charReference.GetReferenceInfo(_key);
	}

	// Token: 0x0600089B RID: 2203
	public abstract void SetVisibleAll(bool _visible);

	// Token: 0x040007FA RID: 2042
	public static readonly int AnmParam_Height = Animator.StringToHash("Height");

	// Token: 0x04000804 RID: 2052
	public DefParam defParam;

	// Token: 0x04000806 RID: 2054
	protected float eyeOpen = 1f;

	// Token: 0x04000807 RID: 2055
	protected float mouthOpen;

	// Token: 0x04000808 RID: 2056
	protected string eyeState = "Eye_Def";

	// Token: 0x04000809 RID: 2057
	protected string mouthState = "Mouth_Def";

	// Token: 0x0400080A RID: 2058
	protected string lipSyncState = string.Empty;

	// Token: 0x0400080D RID: 2061
	protected float nowTearsRate;

	// Token: 0x0400080E RID: 2062
	protected float nowFlushRate;

	// Token: 0x04000810 RID: 2064
	protected LookAtRotator eyeLook;

	// Token: 0x04000811 RID: 2065
	protected LookAtRotator.TYPE eyeLookType;

	// Token: 0x04000812 RID: 2066
	protected Transform eyeLookTarget;

	// Token: 0x04000813 RID: 2067
	protected bool eyeLookForce;

	// Token: 0x04000814 RID: 2068
	protected LookAtRotator neckLook;

	// Token: 0x04000815 RID: 2069
	protected LookAtRotator.TYPE neckLookType;

	// Token: 0x04000816 RID: 2070
	protected Transform neckLookTarget;

	// Token: 0x04000817 RID: 2071
	protected bool neckLookForce;

	// Token: 0x0400081B RID: 2075
	protected Dictionary<string, HumanAttachItem> attachItem = new Dictionary<string, HumanAttachItem>();

	// Token: 0x0400081D RID: 2077
	protected List<HumanAttachItem> restrictItems = new List<HumanAttachItem>();

	// Token: 0x0400081F RID: 2079
	protected HumanAttachItem gagItem;

	// Token: 0x04000820 RID: 2080
	protected bool gagShow = true;
}
